<template>
  <div class='container'>
    <el-dialog title="题目审核" :visible="showCheckDialog" width="400px" @close="$emit('update', false)">
      <div>
        <el-radio v-model="dataa.chkState" label="1">通过</el-radio>
        <el-radio v-model="dataa.chkState" label="2">拒绝</el-radio>
      </div>
      <div style="margin-top: 22px">
        <el-input type="textarea" :rows="2" placeholder="请输入审核意见" v-model="dataa.chkRemarks"></el-input>
      </div>
      <el-row slot="footer" type="flex" justify="end">
          <el-button size="small" @click="cancel">取消</el-button>
          <el-button size="small" type="primary" @click="Ok">确认</el-button>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '../../api/hmmm/questions'
export default {
  props: {
    showCheckDialog: {
      type: Boolean,
      required: true
    },
    id: {
      type: Number,
      default: null
    }
  },
  data () {
    return {
      dataa: {
        chkRemarks: '',
        chkState: '1'
      }
    }
  },
  methods: {
    async Ok () {
      if (this.dataa.chkRemarks === '') {
        this.$message.warning('请完成审核信息')
        return
      }
      this.dataa.id = this.id
      this.dataa.chkState = this.dataa.chkState * 1
      await choiceCheck(this.dataa)
      this.$emit('update', false)
      this.$message.success('操作成功')
      this.dataa = {
        chkRemarks: '',
        chkState: '1'
      }
      this.$parent.choice()
    },
    cancel () {
      this.dataa = {
        chkRemarks: '',
        chkState: '1'
      }
      this.$emit('update', false)
    }
  }
}
</script>

<style scoped lang='less'></style>
